/**
 * 
 */
package com.jfinal.ext.interceptor;

import org.apache.log4j.Logger;
import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.server.ExceptionAdvisor;

/**
 * @author y.z
 * exception By Service
 */
public class ServiceErrorInterceptor implements Interceptor {
	private static final Logger log = Logger.getLogger(ServiceErrorInterceptor.class);
	/* (non-Javadoc)
	 * @see com.jfinal.aop.Interceptor#intercept(com.jfinal.aop.Invocation)
	 */
	@Override
	public void intercept(Invocation inv){
		try {
			inv.invoke();
		} catch (Exception e) {
			ExceptionAdvisor.serviceExceptionMsg(e,inv);
			log.error("Service exception:"+inv.getTarget().getClass());
			/*try {
				throw e;
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}*/
		}

	}

}
